<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layuiAdmin pro - 通用后台管理模板系统（单页面专业版）</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="__STATIC__/lib/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__STATIC__/admin/css/style.css">
    <script src="__STATIC__/lib/layui/layui.js" ></script>
    <script src="__STATIC__/admin/js/jquery-3.3.1.js"></script>

    <script type="text/javascript" charset="utf-8" src="__STATIC__/components/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__STATIC__/components/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="__STATIC__/components/ueditor/lang/zh-cn/zh-cn.js"></script>

    <link id="layuicss-layuiAdmin" rel="stylesheet" href="__STATIC__/admin/css/admin.css" media="all">
</head>
<body layadmin-themealias="default" class="layui-layout-body" style="">
<div id="LAY_app" class="layadmin-tabspage-none">
    <div class="layui-layout layui-layout-admin">
        <!--头部文件-->
        {include file="common/header"/}
        <!--左侧导航栏-->
        {include file="common/left"/}

        <!-- 主体内容 -->
        <div class="layui-body" id="LAY_app_body">
            <div class="layadmin-tabsbody-item layui-show">
                <div class="layui-card layadmin-header">
                    <div class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
                        <a lay-href="{:url('index/index')}">主页</a><span lay-separator="">/</span>
                        <a><cite>内容管理</cite></a><span lay-separator="">/</span>
                        <a><cite>文章列表</cite></a><span lay-separator="">/</span>
                        <a><cite>修改文章</cite></a>
                    </div>
                </div>


                <div class="layui-fluid">
                    <div class="layui-card" style="padding-bottom: 20px;padding-top: 20px;">
                        <form class="layui-form" method="post" action="{:url('edit')}" enctype="multipart/form-data">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">文章标题</label>
                                    <div class="layui-input-inline">
                                        <input type="hidden" name="id" value="{$cur_article['id']}">
                                        <input type="text" name="title" lay-verify="cate_name" autocomplete="off" class="layui-input" value="{$cur_article['title']}">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">文章缩略图</label>
                                    <div class="layui-input-inline" style="position: relative">
                                        <input type="file" name="file" style="padding-top: 6px" >
                                        <div style="    width: 100px;min-height: 90px;position: absolute;left: 229px;top: -17px;">
                                            <img src="__STATIC__.{$cur_article['pic']}" style="width: 100%" alt="缩略图">
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">文章来源</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="from" lay-verify="cate_name" autocomplete="off" class="layui-input" value="{$cur_article['from']}">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">文章作者</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="author" lay-verify="cate_name" autocomplete="off" class="layui-input" value="{$cur_article['author']}">
                                    </div>
                                </div>
                            </div>


                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">所属栏目</label>
                                    <div class="layui-input-inline">
                                        <select class="layui-select" name="cateid" layui-verify="">
                                            <option value="0">顶级栏目</option>
                                            {foreach $cateLst as $key=>$vo}
                                            <option value="{$vo['id']}"  {if condition="$vo['id'] eq $cur_article['cateid']"} selected {/if}  ><?php  if($vo['level']!=0) echo '|'.str_repeat('------',$vo['level'])?>   {$vo['cate_name']}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">状态</label>
                                    <div class="layui-input-inline">
                                        <select class="layui-select" name="status" layui-verify="">
                                            <option value="0"  {if condition="$cur_article['status'] eq 0"} selected {/if} >未审核</option>
                                            <option value="1" {if condition="$cur_article['status'] eq 1"}selected {/if} >审核通过</option>
                                            <option value="1" {if condition="$cur_article['status'] eq 2"} selected {/if} >禁止发布</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">文章描述</label>
                                <div class="layui-col-md8">
                                    <textarea name="des" placeholder="请输入描述内容" class="layui-textarea">{$cur_article['des']}</textarea>
                                </div>
                            </div>

                            <!--start 控制编辑器的样式，主要是控制编辑器的宽度和父级标签一致-->
                            <style>
                                .edui-editor{
                                    width: 100% !important;
                                }
                            </style>
                            <!--end 控制编辑器的样式，主要是控制编辑器的宽度和父级标签一致-->
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">文章内容</label>
                                <div class="layui-col-md8" style="z-index: 0">
                                    <textarea name="content" id="editor"  style="padding: 0px;border: none; " placeholder="请输入文章内容" >{$cur_article['content']}</textarea>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">文章关键字</label>
                                <div class="layui-col-md8">
                                    <input type="text" name="keywords" value="{$cur_article['keywords']}"  lay-verify="required" placeholder="请输入关键字以逗号分隔; 如: 生活，科技" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn"  type="submit"  lay-submit="" lay-filter="sub">提交</button>
                                    <a class="layui-btn layui-btn-primary" href="{:url('lst')}">返回</a>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    $(function () {
        var ue = UE.getEditor('editor',{
            initialFrameHeight:300,
        });
        layui.use('form',function (data) {
            // var form=layui.form; var layer=layui.layer;
            // form.render();  //下拉框弹出
            // form.on("submit(sub)",function (data) {
            //     //提交数据
            //     console.log(data.field);
            //     $.post("{:url('add')}",data.field,function (res) {
            //         if(res.code==1){
            //             layer.msg(res.msg,{icon:1,time:1800});
            //             setTimeout(function () {
            //                 window.location.href="{:url('lst')}";
            //             },1500);
            //         }else {
            //             layer.msg(res.msg,{icon:5,time:1800});
            //         }
            //         return false;
            //     });
            //
            //     return false;
            // });

        });

        // layui.use('upload', function(){
        //     var $ = layui.jquery
        //         ,upload = layui.upload;
        //
        //     //普通图片上传
        //     var uploadInst = upload.render({
        //         elem: '#test1'
        //         ,url: '/upload/'
        //         ,before: function(obj){
        //             //预读本地文件示例，不支持ie8
        //             obj.preview(function(index, file, result){
        //                 $('#demo1').attr('src', result); //图片链接（base64）
        //             });
        //         }
        //         ,done: function(res){
        //             //如果上传失败
        //             if(res.code > 0){
        //                 return layer.msg('上传失败');
        //             }
        //             //上传成功
        //         }
        //         ,error: function(){
        //             //演示失败状态，并实现重传
        //             var demoText = $('#demoText');
        //             demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
        //             demoText.find('.demo-reload').on('click', function(){
        //                 uploadInst.upload();
        //             });
        //         }
        //     });
        // });


    });



</script>


</html>